#-*- coding: utf-8 -*-
from openerp.osv import osv, fields

class res_partner(osv.Model):

    _inherit = "res.partner"

    _columns = {
        'code': fields.char('Code'),
        'birthday': fields.date('Bithday'),
        'password': fields.char('Password'),
    }
    
    def _get_sequence(self, cr, uid, context=None):
        obj_seq = self.pool.get('ir.sequence')
        args_search = [('code', '=', 'res.partner')]
        sequence_ids = obj_seq.search(cr, uid, args_search, context=context)

        return obj_seq.next_by_id(cr, uid, sequence_ids[0], context=context)

    def create(self, cr, uid, vals, context=None):
        if context == None:
            context = {}

        vals['code'] = self._get_sequence(cr, uid, context)

        return super(res_partner, self).create(cr, uid, vals, context=context)